Skip to content

Latest commit

 

History

History
280 lines (148 loc) · 7.35 KB

typed conversions.rst

File metadata and controls

280 lines (148 loc) · 7.35 KB

Typed Conversions

Typed conversions are of the form {prefix}(s?)n(r?)to{suffix}(s?)n. The prefix/suffix mapping can be found in the design documentation for conversions </design/naming>. This page covers the canonical conversions, which are from UTF-8/16/32 and the execution/wide execution encodings, to each other.

The "prefix" represents the source data. The "suffix" represents the destination data. The s stands for "string", which means a bulk conversion. The r in the name stands for "restartable", which means the function takes an cnc_mcstate_t pointer or similar state pointer. If there s is not present in the name, it is a single conversion function. If the r is not present in the name, it is the "non-restartable" version (the version that does not take the state).

Important

Non-restartable functions mean that a automatic storage duration object unique to the function invocation is created for you, before being used. If there is any necessary state left in the object before the function ends, it ends up being discarded and lost if the non-restartable functions are used.

Additional encodings not meant to be in the "core set" supported by a typical C or C++ implementation, and that have definitive names other than the Unicode encodings, can be found in the encodings documentation</api/encodings>.

Important

Any function which does not convert to the execution encoding or wide execution encoding are guaranteed not to touch the locale (as defined by LC_CTYPE).

Warning

If an encoding conversion goes to or from either the execution encoding or the wide execution encoding, it may touch the locale which may perform a lock or other operations. If multiple function calls are used and LC_CTYPE is changed between any of those function calls without properly clearing the cnc_mcstate_t </api/mcstate_t> object to the initial shift sequence, the behavior of the functions become unspecified and DANGEROUS.

Bulk Conversion Functions

Note

The description for most of these functions is identical. Any relevant information is contained above.

cnc_mcsntomcsn

cnc_mcsnrtomcsn

cnc_mcsntomwcsn

cnc_mcsnrtomwcsn

cnc_mcsntoc8sn

cnc_mcsnrtoc8sn

cnc_mcsntoc16sn

cnc_mcsnrtoc16sn

cnc_mcsntoc32sn

cnc_mcsnrtoc32sn

cnc_mwcsntomcsn

cnc_mwcsnrtomcsn

cnc_mwcsntomwcsn

cnc_mwcsnrtomwcsn

cnc_mwcsntoc8sn

cnc_mwcsnrtoc8sn

cnc_mwcsntoc16sn

cnc_mwcsnrtoc16sn

cnc_mwcsntoc32sn

cnc_mwcsnrtoc32sn

cnc_c8sntomcsn

cnc_c8snrtomcsn

cnc_c8sntomwcsn

cnc_c8snrtomwcsn

cnc_c8sntoc8sn

cnc_c8snrtoc8sn

cnc_c8sntoc16sn

cnc_c8snrtoc16sn

cnc_c8sntoc32sn

cnc_c8snrtoc32sn

cnc_c16sntomcsn

cnc_c16snrtomcsn

cnc_c16sntomwcsn

cnc_c16snrtomwcsn

cnc_c16sntoc8sn

cnc_c16snrtoc8sn

cnc_c16sntoc16sn

cnc_c16snrtoc16sn

cnc_c16sntoc32sn

cnc_c16snrtoc32sn

cnc_c32sntomcsn

cnc_c32snrtomcsn

cnc_c32sntomwcsn

cnc_c32snrtomwcsn

cnc_c32sntoc8sn

cnc_c32snrtoc8sn

cnc_c32sntoc16sn

cnc_c32snrtoc16sn

cnc_c32sntoc32sn

cnc_c32snrtoc32sn

Single Conversion Functions

Note

The description for most of these functions is identical. Any relevant information is contained above.

cnc_mcntomcn

cnc_mcnrtomcn

cnc_mcntomwcn

cnc_mcnrtomwcn

cnc_mcntoc8n

cnc_mcnrtoc8n

cnc_mcntoc16n

cnc_mcnrtoc16n

cnc_mcntoc32n

cnc_mcnrtoc32n

cnc_mwcntomcn

cnc_mwcnrtomcn

cnc_mwcntomwcn

cnc_mwcnrtomwcn

cnc_mwcntoc8n

cnc_mwcnrtoc8n

cnc_mwcntoc16n

cnc_mwcnrtoc16n

cnc_mwcntoc32n

cnc_mwcnrtoc32n

cnc_c8ntomcn

cnc_c8nrtomcn

cnc_c8ntomwcn

cnc_c8nrtomwcn

cnc_c8ntoc8n

cnc_c8nrtoc8n

cnc_c8ntoc16n

cnc_c8nrtoc16n

cnc_c8ntoc32n

cnc_c8nrtoc32n

cnc_c16ntomcn

cnc_c16nrtomcn

cnc_c16ntomwcn

cnc_c16nrtomwcn

cnc_c16ntoc8n

cnc_c16nrtoc8n

cnc_c16ntoc16n

cnc_c16nrtoc16n

cnc_c16ntoc32n

cnc_c16nrtoc32n

cnc_c32ntomcn

cnc_c32nrtomcn

cnc_c32ntomwcn

cnc_c32nrtomwcn

cnc_c32ntoc8n

cnc_c32nrtoc8n

cnc_c32ntoc16n

cnc_c32nrtoc16n

cnc_c32ntoc32n

cnc_c32nrtoc32n